package com.neu.wangweili.service;

import com.neu.commons.Utils.ShortMsgUtil;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class W_SendMsgService {
    private ShortMsgUtil shortMsgUtil=null;
    public W_SendMsgService(){
        shortMsgUtil=new ShortMsgUtil();
    }
    public String sendMsg(String tel){
        String text="发送失败";
        try {
            Long shu=Math.round(Math.random()*9999);
            while (shu<1000){
                shu=Math.round(Math.random()*9999);
            }
             text=String.valueOf(shu);
            System.out.println(text);
          int statisCode=shortMsgUtil.sendMsg(tel,text);
          if(statisCode<0){
                text="发送失败";
          }
        } catch (IOException e) {
            e.printStackTrace();
//            记录错误
        }
        return text;
    }
}
